
import { Heading as OriginalHeading } from "element-tiptap";
import CustomMenuButton from './MenuButton.vue'

export default class Heading extends OriginalHeading {
    constructor(option = {}) {
        super(option)
        this.level = option.level || 6
    }
    menuBtnView(editorContext) {
        return {
            component: CustomMenuButton,
            componentProps: {
                level: this.level,
                isActive: editorContext.isActive.heading()
            },
            componentEvents: {
                command(level) {
                    editorContext.commands.heading({ level })
                }
            }
        };
    }
}